package com.maixy.studyonlineapi.exceptions;


import com.maixy.studyonlineapi.bean.State;
import com.maixy.studyonlineapi.constants.GlobalConstant;
import lombok.Getter;
import lombok.Setter;

/**
 * @Description TODO
 * @Date 2020/7/27 19:01
 * @Created by maixy
 */
@Getter
@Setter
public class ApiException extends RuntimeException {
    private int code;
    private String msg;

    public ApiException() {
        this(GlobalConstant.StateCode.API_EXCEPTION);
    }

    public ApiException(State state) {
        this.code = state.getCode();
        this.msg = state.getMsg();
    }
}
